﻿using Dapper.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YouWei.Infrastructure.Entity;
using YouWei.Infrastructure.Models;
using YouWei.Infrastructure.Service;
using YouWei.Op.Models.User;

namespace YouWei.Op.Controllers
{
    /// <summary>
    /// 用户
    /// </summary>
    public class BUserController : BaseController
    {
        BUserInfoService usrService = new BUserInfoService();
        // GET: User
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 查询列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ContentResult List(BUserSearchModel model)
        {
            int pageIndex = GetPageIndex();
            int pageSize = GetPageSize();
            Page<BUserInfoPageModel> page = usrService.Pages(pageIndex, pageSize, model);
            return ReturnResult(page);
        }

        /// <summary>
        /// 获取用户详情
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Detail(int userId)
        {
            BUserInfo usr = usrService.Single(userId);
            return View(usr);
        }
    }
}